home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / UTILS / AMOSPRO4.DMS / in.adf / Tutorials / AMAL / AMAL_5.AMOS / AMAL_5.amosSourceCode
Encoding:
AMOS Source Code  |  1992-09-28  |  5.3 KB  |  156 lines

  1. '*************************** 
  2. '*    AMOS Professional    * 
  3. '*                         * 
  4. '*         AMAL_5          *                Amal Play Routines 
  5. '*                         *               + STOS compatability
  6. '* (c) Europress Software  * 
  7. '*                         * 
  8. '*     Ronnie Simpson      * 
  9. '*************************** 
  10. '
  11. '------------------------------------------- 
  12. 'Play
  13. '------------------------------------------- 
  14. 'Keyword PL
  15. '
  16. 'The Amal Play instruction controls a movement pattern previously defined by 
  17. 'the Amal accessory program which simply records a sequence made by moving 
  18. 'the mouse and stores the information into a bank. 
  19. 'Objects are assigned to the paths from within your Amal program with the
  20. 'PLay (PL) instruction followed by the path number.
  21. '
  22. 'eg.        PLay 1 
  23. '
  24. 'The internal register R0 now contains the tempo setting, and changing this  
  25. 'will either slow down or speed up the movement. (measured in 1/50ths. of a  
  26. 'second) 
  27. 'The internal register R1 can be used to control the direction of movement:- 
  28. '
  29. '      If R1>0   then movement will follow the path as defined 
  30. '      If R1=0   then movement will follow the path in reverse 
  31. '      If R1=-1  then movement will be aborted 
  32. '
  33. '------------------------------------------- 
  34. 'Amplay
  35. '------------------------------------------- 
  36. 'Control Amal play from basic
  37. '
  38. 'The Amal PLay instruction is controlled by the internal registers R0 & R1 
  39. 'of each individual channel and these can be changed with the Amreg= command.
  40. 'The purpose of the Amplay instruction is to allow the settings to be altered
  41. 'over a range of channels in one fell swoop. 
  42. '
  43. '                     +---> Tempo
  44. '                     | +---> Direction
  45. '                     | |   +---> Range of channels
  46. '              Amplay 2,1,3 To 6 
  47. '
  48. 'See the above Amal PLay instruction for tempo and direction settings. 
  49. 'If the range of channels are ommited then all channels will be affected.
  50. 'Any of the parameters may be ommited as required:-
  51. '
  52. '              Amplay ,-1  (abort movement on all channels)
  53. '              Amplay 2,   (change tempo of all channels)
  54. '
  55. '------------------------------------------- 
  56. 'STOS compatible commands
  57. '------------------------------------------- 
  58. 'Although Amal is far superior to the original STOS animation control the
  59. 'following list is a quick reference to STOS commands retained for 
  60. 'compatibility.  
  61. '
  62. '    Move X N,A$         N=channel number 0-15   
  63. '                        A$=instruction sequence   
  64. '    Move Y N,A$         N=channel number 0-15   
  65. '                        A$=instruction sequence   
  66. '    Move On N           N=optional channel number 
  67. '    Move Off N          N=optional channel number 
  68. '    Move Freeze N       N=optional channel number 
  69. '    = Moveon (N)        N=object number 
  70. '    Anim N,A$           N=channel number 0-15   
  71. '                        A$=instruction sequence   
  72. '    Anim On N           N=optional sequence number  
  73. '    Anim Off N          N=optional sequence number  
  74. '    Anim Freeze N       N=optional sequence number  
  75. '    Freeze / Unfreeze   No parameters and works the same as Amal Freeze   
  76. '
  77. '------------------------------------------- 
  78. 'EXAMPLE 
  79. '------------------------------------------- 
  80. Rem *** tidy up screen, load sprites and load PLay sequence
  81. '
  82. Colour Back $3
  83. Load "AmosPro_Tutorial:Objects/PLay_Bobs.abk"
  84. Load "AmosPro_Tutorial:Tutorials/Amal/PLay_Data.abk"
  85. Screen Open 0,320,200,16,Lowres : Flash Off 
  86. Get Sprite Palette : Curs Off : Cls 0 : Hide 
  87. Make Mask 
  88. For N=1 To 100 : Ink Rnd(1)+2 : Plot Rnd(316)+2,Rnd(196)+2 : Next 
  89. Ink 3 : Box 0,0 To 319,199
  90. Paper 0 : Pen 7 : Ink 7 : Box 3,119 To 5,191 : Locate 1,23 : Print "Power"
  91. Ink 5 : Draw 4,120 To 4,190
  92. Limit Mouse 152,100 To 440,200
  93. '
  94. Rem *** define Amal program for moving ship
  95. '
  96. A$="Anim 0,(5,5)(6,5);Loop: Let X=XM-148;If K1 Jump Up;Jump Down;"
  97. A$=A$+"Up: Let Y=Y-1;If Y<75 Jump A; Pause Jump Loop;A: LetY=75;PJL"
  98. A$=A$+"Down: Let Y=Y+1;If Y>165 Jump B; Pause Jump Loop;B: LetY=165;PJL"
  99. '
  100. Rem *** define Amal program for moving aliens with PLay instruction
  101. '
  102. B$="Anim 0,(1,3)(2,3)(3,3)(4,3);Loop: Let X=Z(220)+160;Let Y=40"
  103. B$=B$+"PLay 1;Pause Jump Loop"
  104. '
  105. Rem *** assign Amal channels 
  106. '
  107. Bob 1,0,135,5
  108. Channel 0 To Bob 1
  109. For N=8 To 15
  110.    Sprite N,0,0,1
  111.    Amal N,B$
  112. Next 
  113. Amal 0,A$
  114. '
  115. Rem *** start ship movement
  116. '
  117. Amal On 0
  118. '
  119. Rem *** define the variables required
  120. '
  121. HITS=0 : P=120 : LEVEL=7 : COUNT=799 : SPEED=3 : Pen 13
  122. '
  123. Rem start the main loop
  124. '
  125. Repeat 
  126.    Rem *** increase number of aliens
  127.    Inc COUNT
  128.    If COUNT=800 and LEVEL<15
  129.       Inc LEVEL : Amal On LEVEL : Amplay SPEED,
  130.       Locate 5,1 : Centre "LEVEL-"+Str$(LEVEL-7)
  131.       COUNT=0
  132.    End If 
  133.    Rem *** increase tempo of Play movement
  134.    If COUNT=800 and LEVEL>14
  135.       Inc LEVEL : Dec SPEED : Amplay SPEED,
  136.       Locate 5,1 : Centre "LEVEL-"+Str$(LEVEL-7)
  137.       COUNT=0
  138.    End If 
  139.    Rem *** collision detection routine
  140.    If Bobsprite Col(1)
  141.       Inc HITS : Boom 
  142.       Ink 0 : Draw 4,120 To 4,120+HITS*10
  143.       For N=1 To 5 : Colour 0,$FF0 : Wait Vbl : Colour 0,0 : Next 
  144.    End If 
  145.    Wait Vbl 
  146. Until HITS=7
  147. '
  148. Amal Off 0 : Ink 6 : Circle X Bob(1)+11,Y Bob(1)+15,20 : Ink 8 : Circle X Bob(1)+11,Y Bob(1)+15,19
  149. Pen 8 : C$="G A M E   O V E R"
  150. For N=80 To 30 Step -1 : Wait Vbl : Bell N : Next 
  151. For N=1 To Len(C$)
  152.    Locate 0,12 : Centre Mid$(C$,1,N)
  153.    Wait 7
  154. Next 
  155. Wait 150
  156. Direct